package com.xwltz.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.xwltz.enums.StatusEnum;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
@TableName("student")
public class Student {

    @TableId(type = IdType.AUTO)
    @NotNull(message = "不能为空")
    private Long id;

    @NotEmpty(message = "姓名不能为空")
    @Length(min = 2, message = "最小字符不能小于2位")
    private String name;

    @TableField(select = false)
    @Min(value = 16, message = "年龄必须大于16")
    private Integer age;

    @TableField(exist = false)
    private Double score;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @Version
    private Integer version;

    private StatusEnum status;

    @TableLogic
    private Integer isDelete;
}
